//
//  NewAdvisoryViewCell.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/2/9.
//  Copyright © 2020 tao Tao. All rights reserved.
//

import UIKit

class NewAdvisoryViewCell: UITableViewCell {
    
    func configure(with vm: DoctorViewModel.RowViewModel) {
        avatarView.kf.setImage(with: URL(string: vm.thumbnailAvatar),
                               placeholder: UIImage(named: "avatar_default"))
        nameLabel.text = vm.doctorName
        departmentLabel.text = vm.departmentName
        officeLabel.text = vm.office
        peopleLabel.text = vm.peopleCount
        costLabel.text = vm.cost
        specialtyLabel.text = vm.specialty
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        selectionStyle = .none
        contentView.backgroundColor = .background
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        containerView.backgroundColor = selected ? .splLineNormal : .white
    }
    
    @IBOutlet private weak var containerView: UIView! {
        didSet {
            containerView.backgroundColor = .white
            containerView.layer.cornerRadius = 8
            containerView.layer.masksToBounds = true
        }
    }
    
    @IBOutlet private weak var avatarView: UIImageView! {
        didSet {
            avatarView.contentMode = .scaleAspectFill
            avatarView.layer.cornerRadius = avatarView.height * 0.5
            avatarView.layer.masksToBounds = true
        }
    }
    @IBOutlet private weak var nameLabel: UILabel!
    @IBOutlet private weak var departmentLabel: UILabel! {
        didSet {
            departmentLabel.layer.cornerRadius = 5
            departmentLabel.layer.masksToBounds = true
        }
    }
    @IBOutlet private weak var officeLabel: UILabel!
    @IBOutlet private weak var specialtyLabel: UILabel!
    @IBOutlet private weak var peopleLabel: UILabel!
    @IBOutlet private weak var costLabel: UILabel!
    
}
